package selectClass;
import lombok.Data;
import org.hibernate.validator.constraints.CreditCardNumber;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Data
@Entity
//@Table(name="Student")
public class Student implements Serializable {
    @NotBlank
    @Size(min = 2, message = "Name must be at least 2 characters long")
    private String name;

    @NotNull
    @Size(min = 9, max = 9, message = "Student number must be 9 characters long")
    private String studentNumber;

    @NotBlank
    private String grade;

    @NotBlank
    private String major;

    @NotBlank
    private String college;

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    private Date placedAt;

    @PrePersist
    void placedAt() {
        this.placedAt = new Date();
    }

}
